<!DOCTYPE html>
<html>
<head>
<meta content="telephone=no" name="format-detection">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Language" content="zh-CN">
<meta http-equiv="x-ua-compatible" content="IE=edge, chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<meta name="keywords" content="关键词" />
<meta name="description" content="页面简介" />
<link rel="icon" href="favicon.ico" />
<link rel="shortcut icon" href="favicon.ico" />
<link href="../csaa/css/style.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="../csaa/fonts/iconfont/iconfont.css">
<link rel="stylesheet" href="../csaa/fonts/materialicons/material-icons.css">

<script language="javascript" type="text/javascript" src="../csaa/js/jquery.min.js"></script>
<script src="../csaa/js/httpPath.js"></script>
<script src="../csaa/js/httpUtils.js"></script>
<script language="javascript" type="text/javascript" src="../csaa/js/site.js"></script>
<title>全国青少年航空科学素质等级考试</title>
</head>
<body id="manage" style="min-height: 1288px;">
	<div id="loader" class="hide"></div>

<!-- 头部 开始 -->
<header id="m_header" class="m_navbar m_header">
	<div class="container-fluid">
	  <div class="navbar-header">
		<a class="navbar-brand" href="../index.html" style="background-image: url(../csaa/img/logo_blue.png);"></a>
		<span>全国青少年无人机科学素质等级考试</span>
	  </div>


		<div class="header_login">
			<a class="item username" href="./usercenter.html" style="display:none">丁培培</a>
			<a class="item signout" style="display:none; ">退出</a>
			<a class="item back_web btn btn_color_1" href="../index.html">返回官网</a>
		</div>

	</div>
  </header>
<!-- 头部 结束 -->


<!-- 侧边栏 -->
<div id="siderbar">
	<div class="box">
		<a href="./usercenter.html" class="list-group-item " title="考点等级"><i class="material-icons">&#xe31a;</i><span>考点等级</span></a>
		<a href="./usercenter_home.html" class="list-group-item " title="账号中心"><i class="material-icons">&#xe80b;</i><span>账号中心</span></a>
	</div>
</div>
<!-- 侧边栏 -->

<!-- 主体 开始 -->
<div id="content">
	<div class="content_box">
		<div class="djhome card">
			<div class="form_box">
				<form id="register_form" autocomplete="off">
                    <div class="part_title">账号中心</div>
                    <div class="btn btn_color_1 btn_edit">修改</div>
					<div class="form_group">
						<label class="form_label">
						  <div class="cn"><span class="star">*</span>单位名称</div>
						</label>
						<div class="form_item_con">
						  <input type="text" class="form_input rowwidth_30" name="company" value="1111" readonly>
						</div>
                    </div>
                    <div class="form_group">
						<label class="form_label">
						  <div class="cn">考点编号</div>
						</label>
						<div class="form_item_con">
						  <span class="text kaodian_num">556666</span>
						</div>
					</div>
					<div class="form_group">
						<label class="form_label">
						  <div class="cn">用户名</div>
						</label>
						<div class="form_item_con">
                          <span class="text account_number">dsvgsdb</span>
						</div>
					</div>
					<!-- <div class="form_group">
						<label class="form_label">
						  <div class="cn"><span class="star">*</span>密码</div>
						</label>
						<div class="form_item_con">
						  <input type="password" class="form_input rowwidth_30" name="password" placeholder="请输入新密码" maxlength="25" readonly>
						</div>
					</div> -->
					<div class="form_group">
						<label class="form_label">
						  <div class="cn">认证期限</div>
						</label>
						<div class="form_item_con">
                          截止
						  <!-- <input type="text" class="form_input rowwidth_10" name="time_out" value="2020-10-20" readonly style="display: inline-block;"> -->
						  <span class="text time_out">--</span>
						</div>
                    </div>
					<div class="form_group" id="enroll_otherchild">
						<label class="form_label">
						  <div class="cn"><span class="star">*</span>考点地址</div>
						</label>
						<div class="form_item_con">
						  <select class="form_input form_select rowwidth_10 disabled" placeholder="省份" name="province" id="province">

						  </select>
						  <select class="form_input form_select rowwidth_10" placeholder="地级市" name="city" id="city">

						  </select>
						  <select class="form_input form_select rowwidth_20" placeholder="市、县级市、县" name="area" id="area">

						  </select>
                          <input type="text" class="form_input form_select rowwidth_30" placeholder="请输入详细地址" name="detail_area" readonly>


						</div>
					</div>
					<div class="form_group">
						<label class="form_label">
						  <div class="cn"><span class="star">*</span>选择考点经纬度</div>
						</label>

						<div class="form_item_con">
							<input id="address" type="text" name="companyAddress" required lay-verify="required" placeholder="请输入，如：北京市天安门" autocomplete="on" class="form_input rowwidth_30" readonly>
							<input type="hidden" name="longitude_d">
                            <input type="hidden" name="latitude_d">
						</div>
					</div>
					<div class="form_group">
						<label class="form_label">
						  <div class="cn"><span class="star">*</span>考点负责人姓名</div>
						</label>
						<div class="form_item_con">
						  <input type="text" class="form_input rowwidth_30" name="fuze_name" readonly>
						</div>
                    </div>

					<div class="form_group">
						<label class="form_label">
						  <div class="cn"><span class="star">*</span>负责人职务</div>
						</label>
						<div class="form_item_con">
						  <input type="text" class="form_input rowwidth_30" name="fuze_job" readonly>
						</div>
					</div>
					<div class="form_group">
						<label class="form_label">
						  <div class="cn"><span class="star">*</span>负责人联系方式</div>
						</label>
						<div class="form_item_con">
						  <input type="text" class="form_input rowwidth_30" name="fuze_phone" readonly>
						</div>
					</div>
					<div class="form_group">
						<label class="form_label">
						  <div class="cn"><span class="star">*</span>考点联系邮箱</div>
						</label>
						<div class="form_item_con">
						  <input type="text" class="form_input rowwidth_30" name="kaodian_email" readonly>
						</div>
					</div>
					<div class="form_group upload_img" id="license_upload">
						<label class="form_label">
						  <div class="cn"><span class="star">*</span>单位执照</div>
						</label>
						<div class="form_item_con">
						  <div class="review_imgbox_wrap">
							<div class="review_imgbox">
							</div>
							<div class="review_imgupload_plus form_imgupload"></div>
							<input type="hidden" name="filename"/>
						  </div>
						</div>
                    </div>

					<div class="form_group upload_img" id="huanjin_upload">
						<label class="form_label">
						  <div class="cn"><span class="star">*</span>考点环境图片</div>
						</label>
						<div class="form_item_con">
						  <div class="review_imgbox_wrap">
							<div class="review_imgbox">
							</div>
							<div class="review_imgupload_plus form_imgupload"></div>
							<input type="hidden" name="filename"/>
						  </div>
						</div>
					</div>

					<!-- <div class="form_group " id="tabplate_fastworkinfo">
						<label class="form_label">
						  <div class="cn"><span class="star">*</span>单位执照2</div>
						</label>
						<div class="form_item_con">
                            <div class="img_wrap">
                                <div class="item_descimgs" style="background-image: url(http://192.168.3.100/keypoint_科森/keypoint/demo/review/goods_review_01.jpg);" data-bigcover="http://192.168.3.100/keypoint_科森/keypoint/demo/review/goods_review_01.jpg" data-thumbnailcover="http://192.168.3.100/keypoint_科森/keypoint/demo/review/goods_review_01.jpg" data-size="5200x2920"></div>
                                <div class="item_descimgs" style="background-image: url(./demo/img/event_02.jpg);" data-bigcover="./demo/img/event_02.jpg" data-thumbnailcover="./demo/img/event_02.jpg" data-size="4000x2250"></div>
                               </div>
						</div>
					</div> -->
					<div class="form_group">
						<label class="form_label">
						  <div class="cn"><span class="star">*</span>考务联系人姓名</div>
						</label>
						<div class="form_item_con">
						  <input type="text" class="form_input rowwidth_30" name="kaowu_name" readonly>
						</div>
                    </div>

					<div class="form_group">
						<label class="form_label">
						  <div class="cn"><span class="star">*</span>考务联系人职务</div>
						</label>
						<div class="form_item_con">
						  <input type="text" class="form_input rowwidth_30" name="kaowu_job" readonly>
						</div>
					</div>
					<div class="form_group">
						<label class="form_label">
						  <div class="cn"><span class="star">*</span>考务联系人手机号</div>
						</label>
						<div class="form_item_con">
						  <input type="text" class="form_input rowwidth_30" name="kaowu_phone" readonly>
						</div>
					</div>

					  <div class="form_group form_manage hide">
						<label class="form_label"></label>
						<div class="form_item_con">
						<div class="manage_wrap">
						  <a id="btn_sumbit" class="btn btn_color_1 btn_sumbit">立即提交</a>
						</div>
						</div>
					  </div>
				</form>
			</div>
		</div>


	</div>


</div>
<!-- 主体 结束 -->




<!-- 上传图片 开始 -->
<div id="part_imgupload" class="subplate_wrap hide">
    <div class="mask"></div>
    <div class="subplate part_imgupload">
      <div class="imgupload_preview_box">
        <img data-blank="../csaa/img/img_blank.png" src="../csaa/img/img_blank.png" id="imgupload_preview" class="imgupload_preview">
        <label class="imgupload_preview_label" for="imgupload_file"></label>
      </div>
      <input type="file" name="imgupload_file" id="imgupload_file" style="position:absolute;clip:rect(0 0 0 0);">

      <input type="hidden" id="imgupload_file_data" name="imgupload_file_data">
    </div>
    <!-- 底栏 开始 -->
    <div id="imgupload_bottombar" class="bottombar bottombar_imgupload">
      <div class="bottombar_box">
        <div class="bottombar_part half">
          <a class="btn_inner btn btn_shadow btn_color_4 btn_cancel">
            <span>取消</span>
          </a>
        </div>
        <div class="bottombar_part">
          <label class="btn_inner btn btn_shadow btn_color_1" for="imgupload_file">
            <span>选择文件</span>
          </label>
        </div>
        <div class="bottombar_part" id="submit_imgupload">
          <a class="btn_buy btn_inner btn btn_shadow btn_color_2">
            <span>提交图片</span>
          </a>
        </div>
      </div>
    </div>

    <div id="crop_bottombar" class="bottombar bottombar_imgupload">
      <div class="bottombar_box">
        <div class="bottombar_part half" id="btn_crop_cancel">
          <a class="btn_inner btn btn_shadow btn_color_4">
            <span>取消裁切</span>
          </a>
        </div>
        <div class="bottombar_part" id="btn_crop_ok">
          <div class="btn_inner btn btn_shadow btn_color_1">
            <span>确认裁切</span>
          </div>
        </div>
      </div>
    </div>
    <!-- 底栏 结束 -->
  </div>
  <!-- 上传图片 结束 -->


<!-- 查看大图 开始 -->
<link rel="stylesheet" href="../csaa/js/photoswipe/photoswipe.css">
<link rel="stylesheet" href="../csaa/js/photoswipe/default-skin/default-skin.css">
<script src="../csaa/js/photoswipe/photoswipe.js"></script>
<script src="../csaa/js/photoswipe/photoswipe-ui-default.min.js"></script>
<!-- 查看大图 结束 -->




  <script src="../csaa/js/exif.js"></script>
  <script src="../csaa/js/getimgdata.js?v=2"></script>
  <script src="../csaa/js/jcrop/js/jquery.Jcrop.js"></script>
  <link rel="stylesheet" href="../csaa/js/jcrop/css/jquery.Jcrop.css" type="text/css">


  <script type="text/javascript" src="https://api.map.baidu.com/api?v=2.0&ak=DaPovYeO1apmksvwBnp5N4OD"></script>

<script>
    fun_islogin(true);//页面头部登录


//载入省级
var params = {
	"level": 1,
	"parentId": 0
};
$.ajax({
	url: GET_AREA,
	data: params,
	type: "GET",
	dataType: "JSON",
	success: function (data, textStatus) {
		if( typeof data != "object" ) {
			data = JSON.parse(data);
		}

		if (data.status == 1) {
			var fetch_data = data.data;
			var tmp_option = "";
			$.each(fetch_data, function(data_i, data_n){
				tmp_option += '<option value="'+data_n.code+'">'+data_n.name+'</option>'
			});
			$('#province').append( tmp_option );
			$("#area").prepend($("<option selected=\"selected\"></option>").text("市、县级市、县"));
		} else {
			$.fn.poptips(data.msg);
		}
	},
	error: function (xhr, textStatus, errorThrown) {
		$.fn.poptips("连接超时，请检查您的网络");
	}
});
//选择省 载入市
$(document).on("change", "#province", function(){
	$('#city').empty();
	$('#area').empty();
	var params = {
		"level": 2,
		"parentId": $(this).val(),
		"code": $(this).val()
	};
	$.ajax({
		url: GET_AREA,
		data: params,
		type: "GET",
		dataType: "JSON",
		success: function (data, textStatus) {
			if( typeof data != "object" ) {
				data = JSON.parse(data);
			}

			if (data.status == 1) {
				var fetch_data = data.data;
				var tmp_option = "";
				$.each(fetch_data, function(data_i, data_n){
					tmp_option += '<option value="'+data_n.code+'">'+data_n.name+'</option>'
				});
				$('#city').append( tmp_option );
				$("#city").prepend($("<option selected=\"selected\"></option>").text("地级市"));
			} else {
				$.fn.poptips(data.msg);
			}
		},
		error: function (xhr, textStatus, errorThrown) {
			$.fn.poptips("连接超时，请检查您的网络");
		}
	});
})
//选择市 载入区县
$(document).on("change", "#city", function(){
	$('#area').empty();
	var params = {
		"level": 3,
		"parentId": $(this).val(),
		"code": $(this).val()
	};
	$.ajax({
		url: GET_AREA,
		data: params,
		type: "GET",
		dataType: "JSON",
		success: function (data, textStatus) {
			if( typeof data != "object" ) {
				data = JSON.parse(data);
			}

			if (data.status == 1) {
				var fetch_data = data.data;
				var tmp_option = "";
				$.each(fetch_data, function(data_i, data_n){
					tmp_option += '<option value="'+data_n.code+'">'+data_n.name+'</option>'
				});
				$('#area').append( tmp_option );
				$("#area").prepend($("<option selected=\"selected\"></option>").text("市、县级市、县"));
			} else {
				$.fn.poptips(data.msg);
			}
		},
		error: function (xhr, textStatus, errorThrown) {
			$.fn.poptips("连接超时，请检查您的网络");
		}
	});
});


    var params ={
        "token": localStorage.getItem("token"),
        "userId": localStorage.getItem("userId")
    }
    var kaodianid;

    $.ajax({
        type: "POST",
        datatype: "json",
        url: GET_getinfo,
        data: params,
        timeout: 20000,
        success: function(data){
            if( typeof data != "object" ) {
             data = $.parseJSON(data);
            }
            var add_data = data.data
            if( data.status == 1 ) {
               //单位名称
               $("[name=company]").val(add_data.companyName);

               kaodianid = add_data.id;

                function formatDate(now) {
                    var year=now.getFullYear();  //取得4位数的年份
                    var month=now.getMonth()+1;  //取得日期中的月份，其中0表示1月，11表示12月
                    var date=now.getDate();      //返回日期月份中的天数（1到31）
                    var hour=now.getHours();     //返回日期中的小时数（0到23）
                    var minute=now.getMinutes(); //返回日期中的分钟数（0到59）
                    var second=now.getSeconds(); //返回日期中的秒数（0到59）
                    return year+"-"+month+"-"+date;
                }
                var g=add_data.endTime; //定义一个时间戳变量
                var d=new Date(g);   //创建一个指定的日期对象


				//编号
                $(".kaodian_num").text( add_data.examinationCode );

               //认证日期
               $(".time_out").text(formatDate(d));

			  //用户名
              $(".account_number").text( localStorage.getItem("userName") );
               //密码
               //$("[name=password]").val(data.data.passWord);

               //省
               //$("[name=province]").val(data.data.province.code).trigger("click");
                console.log(add_data.province.code)
               $("#province option[value='"+add_data.province.code+"']").attr("selected",true);

                //载入市级
                var params11 = {
                    "level": 2,
                    "parentId": add_data.province.code
                };
                $.ajax({
                    url: GET_AREA,
                    data: params11,
                    type: "GET",
                    dataType: "JSON",
                    success: function (data, textStatus) {
                        if( typeof data != "object" ) {
                            data = JSON.parse(data);
                        }

                        if (data.status == 1) {
                            var fetch_data = data.data;
                            var tmp_option = "";
                            $.each(fetch_data, function(data_i, data_n){
                                tmp_option += '<option value="'+data_n.code+'">'+data_n.name+'</option>';
                            });
                            $('#city').append( tmp_option );

                            //$("#area").prepend($("<option selected=\"selected\"></option>").text("市、县级市、县"));
                            $("#city option[value='"+add_data.city.code+"']").attr("selected",true);
                        } else {
                            $.fn.poptips(data.msg);
                        }
                    },
                    error: function (xhr, textStatus, errorThrown) {
                        $.fn.poptips("连接超时，请检查您的网络");
                    }
                });


                //载入市级
                var params22 = {
                    "level": 3,
                    "parentId": add_data.city.code
                };
                $.ajax({
                    url: GET_AREA,
                    data: params22,
                    type: "GET",
                    dataType: "JSON",
                    success: function (data, textStatus) {
                        if( typeof data != "object" ) {
                            data = JSON.parse(data);
                        }

                        if (data.status == 1) {
                            var fetch_data = data.data;
                            var tmp_option = "";
                            $.each(fetch_data, function(data_i, data_n){
                                tmp_option += '<option value="'+data_n.code+'">'+data_n.name+'</option>'
                            });
                            $('#area').append( tmp_option );

                            //$("#area").prepend($("<option selected=\"selected\"></option>").text("市、县级市、县"));
                            $("#area option[value='"+add_data.area.code+"']").attr("selected",true);
                        } else {
                            $.fn.poptips(data.msg);
                        }
                    },
                    error: function (xhr, textStatus, errorThrown) {
                        $.fn.poptips("连接超时，请检查您的网络");
                    }
                });


              //详细地址
              $("[name=detail_area]").val(add_data.companyAddress);
              //考点经纬度
              $("[name=companyAddress]").val(add_data.companyAddress);

              $("[name=longitude_d]").val(add_data.longitude);
              $("[name=latitude_d]").val(add_data.latitude);


              //考点负责人姓名
              $("[name=fuze_name]").val(add_data.chargeName);
              //负责人职务
              $("[name=fuze_job]").val(add_data.chargePost);
              //负责人联系方式
              $("[name=fuze_phone]").val(add_data.chargePhone);
              //考点联系邮箱
              $("[name=kaodian_email]").val(add_data.email);
              //考务联系人职务
              $("[name=kaowu_name]").val(add_data.examinationName);

              //考务联系人职务
              $("[name=kaowu_job]").val(add_data.examinationPost);
              //负责人职务
              $("[name=fuze_job]").val(add_data.chargePost);

              //考务联系人手机号
              $("[name=kaowu_phone]").val(add_data.examinationPhone);

              var company_img ;
              var environment_img;

              company_img = add_data.companyPhoto;
              environment_img = add_data.environmentPhoto;

              arr_company_img = company_img.split(',');
              arr_environment_img = environment_img.split(',');

              //执照
              var tmp_company = "";
              $.each(arr_company_img, function(i, n){
                tmp_company += '<div class="img" data-url="'+n+'" style="background-image:url('+n+')"></div>'
              });
              $('#license_upload .review_imgbox').append( tmp_company );
              //环境
              var tmp_environment = "";
              $.each(arr_environment_img, function(i, n){
                tmp_environment += '<div class="img" data-url="'+n+'" style="background-image:url('+n+')"></div>'
              });
              $('#huanjin_upload .review_imgbox').append( tmp_environment );




            } else {
                //alert( data.msg );
                $.fn.winktips( data.msg );
            }
            return false;
        },
        error: function (XMLHttpRequest, textStatus, errorThrown) {
            $.fn.poptips("连接超时，请检查您的网络");
        }
    });


    //切换修改
    $(document).on("click", ".btn_edit", function(){
        if( $(this).text() == "修改" ){
            $(this).text("返回");
            $(".djhome input").removeAttr("readonly");
            $(".djhome input[name=account_number]").attr("readonly", "readonly");
        } else {
            $(this).text("修改");
            $(".djhome input").attr("readonly", "readonly");
            window.location.reload();
        }
        $(".form_manage,.dx_code").toggleClass("hide");
    })

    //上传图片
    $(".review_imgupload_plus").on("click", function(){

    var $tmp_this = $(this);
    $.fn.cropimgupload({
    btnOKClick: function( data ){

        //var params = $("#imgupload_file_data").serialize();
        var params = {
            "data": $("#imgupload_file_data").val()
        }
        console.log(params)
        $.ajax({
            type: "POST",
            datatype: "json",
            url: POST_IMG,
            data: params,
            timeout: 20000,
            success: function(data){
                if( typeof data != "object" ) {
                data = $.parseJSON(data);
                }
                if( data.status == 0 ) {
                    console.log(data.data.src)
                $tmp_this.siblings(".review_imgbox").append( "<div class=\"img\" data-url=\"" + data.data.src + "\" style=\"background-image:url(" + data.data.src + ")\"></div>" );

                if ($tmp_this.siblings(".review_imgbox").find(".img").length >= 3) {
                    $tmp_this.hide();
                }
                } else {
                //alert( data.msg );
                $.fn.winktips( data.msg );
                }
                return false;
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                $.fn.poptips("连接超时，请检查您的网络");
            }
        });

    }
    });
    });
    //删除图片
    $(".review_imgbox").on("click", ".img", function(){
        var $tmp_this = $(this);
        $tmp_this.fadeOut(function(){
        $(this).remove();
        });
        if( $tmp_this.siblings(".img").length < 4 ) {
        $tmp_this.closest(".review_imgbox").siblings(".review_imgupload_plus").show();
        }

    });


var reg = new RegExp("^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$"); //正则表达式

//失去焦点
$('[name=kaodian_email]').blur(function() {
	var tmp_email = $("[name=kaodian_email]").val()
    if ( !$("[name=kaodian_email]").val() || !reg.test($("[name=kaodian_email]").val()) ) {
		$.fn.winktips("请正确输入邮箱");
	} else {

		$.post( GET_checkUserEmail, {"email":tmp_email}, function(data){

			if( data.status = 0 ){
				$.fn.winktips( data.msg );
			}

		}, "json");
	}
})

//点击工作概述缩略图看大图
$( "body" ).on("click", "#tabplate_fastworkinfo .img_wrap .item_descimgs",function(){
  var tmp_index = $(this).index();

  var $tmp_album = $(this).closest(".img_wrap").find(".item_descimgs");

  fun_item_photo_load( $tmp_album );

  var tmp_album_photo = [];
  $tmp_album.each(function(){

    if( !$(this).data("size") ) {
      return true;
    }

    var size = ($(this).data("size")).split("x");
    tmp_album_photo.push({
      msrc: $(this).data("thumbnailcover"),
      src: $(this).data("bigcover"),//$(this).data("imgurl"),
      w: parseInt(size[0], 10),
      h: parseInt(size[1], 10)
    });

  });
  var options = {

      maxSpreadZoom: 3,
      getThumbBoundsFn: function(index) {
        var thumbnail = $tmp_album[index];
        var pageYScroll = window.pageYOffset || document.documentElement.scrollTop;
        var rect = thumbnail.getBoundingClientRect();
        return {x:rect.left, y:rect.top + pageYScroll, w:rect.width};

      },
      addCaptionHTMLFn: function(item, captionEl, isFake) {
        if(!item.title) {
            captionEl.children[0].innerHTML = '';
            return false;
        }
        captionEl.children[0].innerHTML = item.title;
        return true;
      }
  };
  if ( tmp_index ) {
    options.index = parseInt(tmp_index, 10);
  }

  var pswpElement = document.querySelectorAll('.pswp')[0];
  ( new PhotoSwipe( pswpElement, PhotoSwipeUI_Default, tmp_album_photo, options) ).init();

  return false;
});

fun_insert_photoswipe();//插入“查看大图”容器

//获取图片宽高
function fun_item_photo_load( $target ){
  if( !$target ) {
    var $target = $(".cover");
  }
  $target.not("[data-size]").each(function() {
    if( !$(this).data("bigcover") ) {
      return true;
    }
    var tmp_img = new Image();
    var tmp_imgurl = $(this).data("thumbnailcover");
    tmp_img.src = tmp_imgurl;
    var w = tmp_img.width * 5, h = tmp_img.height * 5;
    if( w && h ){
      $(this).attr("data-size", "").attr("data-size", w+"x"+h);
    }
  });
}


//选择金纬度
var longitude;
var latitude;
//form = layui.form;
var companyPhoto;
var environmentPhoto;

var pois;

var ac = new BMap.Autocomplete(    //建立一个自动完成的对象
	{
		"input" : "address",
		"onSearchComplete":function(e){
			//console.log(e);
			pois = e;
		}

	}
);

ac.addEventListener("onconfirm", function(e) {    //鼠标点击下拉列表后的事件

	var _value = e.item.value;
	console.log("value:" + JSON.stringify(_value));
	$("#address").val(_value.district +  _value.street +  _value.business);

	var local = new BMap.LocalSearch(_value.city, { //智能搜索
		onSearchComplete: function(){

			console.log('local:' + local);
			var pp = local.getResults().getPoi(0).point;    //获取第一个智能搜索的结果
			//console.log(local);
			//console.log(local.getResults());
			//console.log('local:' + local);
			latitude = pp.lat;
			longitude = pp.lng;
		}
	});
	local.search(_value.street +  _value.business);

});

//表单错误滚动到相应位置
function fun_tipshighlight_scroll($tipshighlight_target) {
	if (typeof $tipshighlight_target == "object" && $tipshighlight_target.length) {
		$("html, body").animate({
			scrollTop: $tipshighlight_target.offset().top - 200
		}, "fast");
	}
}



//提交
$("#btn_sumbit").on('click', function(){
	var $this_btn = $(this);



      var latit = $("[name=latitude_d]").val();
      var longit = $("[name=longitude_d]").val();
      console.log(latit);
	  var tmp_parms = {
        "id": kaodianid,
        "userId": localStorage.getItem("userId"),
        "token": localStorage.getItem("token"),
		"level": '0',
		"roleCode": "examin",
		"name": $("[name=company]").val(),//单位名称
		//"userName": $("[name=account_number]").val(),//用户名
		//"passWord": $("[name=password]").val(),//密码
		"provno": $("[name=province]").val(),//省
		"cityno": $("[name=city]").val(),//市
		"areacode": $("[name=area]").val(),//区县
		"companyAddress": $("[name=detail_area]").val(),//详细地址
		"latitude": latit,//纬度
		"longitude": longit,//经度
		//"address": $("[name=address]").val(),//经纬详细地址
		"chargeName": $("[name=fuze_name]").val(),//负责人名
		"chargePost": $("[name=fuze_job]").val(),//负责人职务
		"chargePhone": $("[name=fuze_phone]").val(),//负责人电话
		"examinationName": $("[name=kaowu_name]").val(),//考务名
		"examinationPost": $("[name=kaowu_job]").val(),//考务职能
		"examinationPhone": $("[name=kaowu_phone]").val(),//考务电话
		"email": $("[name=kaodian_email]").val(),//邮箱
		"companyPhoto": '',//单位证件照
		"environmentPhoto": '',//单位环境照
      };

      tmp_parms.longitude = longit;
      tmp_parms.latitude = latit;

      console.log(tmp_parms);
	  var license_img = [];
      var huanj_img = [];

     // $("[name=longitude_d]").val(add_data.longitude);
     // $("[name=latitude_d]").val(add_data.latitude);

     if( $("[name=longitude_d]").val() != longitude ) {
        longit = longitude;
        latit = latitude;

     }

     console.log($("[name=longitude_d]").val())


	  //单位名称
	  if ( !$("[name=company]").val() ) {
		$.fn.winktips("请输入单位名称");
		fun_tipshighlight_scroll($("[name=company]"));
		$("[name=company]").focus();
		return false;
	  }

	  //密码
	//   if ( !$("[name=password]").val() ) {
	// 	$.fn.winktips("请输入密码");
	// 	fun_tipshighlight_scroll($("[name=password]"));
	// 	$("[name=password]").focus();
	// 	return false;
	//   }
	  //单位地址
	  if ( $("[name=province]").val() == "省份" ) {
		$.fn.winktips("请选择单位地址");
		fun_tipshighlight_scroll($("[name=province]"));
		$("[name=province]").focus();
		return false;
	  }

	  //考点金纬度
	  if ( !$("[name=companyAddress]").val() ) {
		$.fn.winktips("请选择考点经纬度");
		fun_tipshighlight_scroll($("[name=companyAddress]"));
		$("[name=companyAddress]").focus();
		return false;
	  }
	  //考点负责人姓名
	  if ( !$("[name=fuze_name]").val() ) {
		$.fn.winktips("请输入考点负责人姓名");
		fun_tipshighlight_scroll($("[name=fuze_name]"));
		$("[name=fuze_name]").focus();
		return false;
	  }
	  //负责人联系方式
	  if ( !$("[name=fuze_phone]").val() || !$("[name=fuze_phone]").val().match(/^1[3456789][0-9]{9}$/) ) {
		$.fn.winktips("请正确输入负责人联系方式");
		fun_tipshighlight_scroll($("[name=fuze_phone]"));
		$("[name=fuze_phone]").focus();
		return false;
	  }
	  var reg = new RegExp("^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$"); //正则表达式
	  //考点联系邮箱
	  if ( !$("[name=kaodian_email]").val() || !reg.test($("[name=kaodian_email]").val()) ) {
		$.fn.winktips("请输入考点联系邮箱");
		fun_tipshighlight_scroll($("[name=kaodian_email]"));
		$("[name=kaodian_email]").focus();
		return false;
	  }
	  //单位执照
      if( $("#license_upload .img").length ) {
          $("#license_upload .review_imgbox .img").each(function(){
             license_img.push( $(this).data("url") );
		  });
		  //var s = a.toString();
		  tmp_parms.companyPhoto = license_img.toString();

       } else {
          $.fn.winktips("请上传单位执照");
          fun_tipshighlight_scroll($("#license_upload")) //表单错误滚动到相应位置

          return false;
       }
	  //环境照片
      if( $("#huanjin_upload .img").length ) {
          $("#huanjin_upload .review_imgbox .img").each(function(){
             huanj_img.push( $(this).data("url") );
         });
		 tmp_parms.environmentPhoto = huanj_img.toString()
       } else {
          $.fn.winktips("请上传环境照片");
          fun_tipshighlight_scroll($("#huanjin_upload")) //表单错误滚动到相应位置

          return false;
       }
	  //考务联系人姓名
	  if ( !$("[name=kaowu_name]").val() ) {
		$.fn.winktips("请输入考务联系人姓名");
		fun_tipshighlight_scroll($("[name=kaowu_name]"));
		$("[name=kaowu_name]").focus();
		return false;
	  }
	  //联系人手机号
	  if ( !$("[name=kaowu_phone]").val() || !$("[name=kaowu_phone]").val().match(/^1[3456789][0-9]{9}$/) ) {
		$.fn.winktips("请正确输入联系人手机号");
		fun_tipshighlight_scroll($("[name=kaowu_phone]"));
		$("[name=kaowu_phone]").focus();
		return false;
	  }

	  console.log(tmp_parms)
	  $.ajax({
          type: "POST",
          url: GET_update,
          dataType: "json",
          data: tmp_parms,
          timeout: 20000,
          beforeSend: function (XMLHttpRequest) {
            $this_btn.addClass("disabled").text("提交中……");
          },
          success: function (data, textStatus) {
            if (data.status == 1) {

				window.location.reload(true);


            } else if (data.status == 0){
              $.fn.winktips(data.msg);
            } else {
              $.fn.winktips("提交失败");
            }
          },
          error: function (XMLHttpRequest, textStatus, errorThrown) {
            $.fn.winktips("连接超时，请检查您的网络");
          },
          complete: function () {
            $this_btn.removeClass("disabled").text("立即提交");
          }
      });

})
</script>
</body>
</html>











